Computer Science Lesson Plan
Class: 7 - Lesson: 11 Debugging

Purpose: To learn how to identify and correct errors (bugs) in Scratch projects. Debugging helps improve logical thinking, attention to detail and resilience in solving problems.

No. of Classes

One or two classes (teacher's decision).

Material Required

Scratch 3.0.

Curriculum Content
  • 2.16) Debugging
  • Prior Knowledge

    Students should know:

  • All the Scratch concepts taught so far - events, loops, variables, clones and custom blocks.
  • Exercises

    Exercise 1



    1. Correct the fruit-catching game below, in which the fruits collect at the bottom of the screen. You need to delete them.

    Exercise 2



    1. Use the link below to download the program that has bugs, and try to debug the code. Watch the video to understand what the bug in the program is.

    Solutions



  • Link to copy the solution program for Exercise 1.
  • Link to copy the solution program for Exercise 2.

  • Teacher Instructions
    1. Introduce the term "bug" and explain it as a mistake or unexpected behaviour in a program.
    2. Teach students how to read code step by step.
    3. Explain strategies such as checking variables, using the green flag to reset, and breaking large scripts into smaller parts to check that each part works.
    4. Encourage students to predict what a script should do, compare that with what it actually does, and then trace the error.
    5. Allow students to work in pairs for peer debugging.
    6. Ask them to think about what they can do to reduce or avoid bugs.